﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BoobyTrap
{
    public partial class frmScreenSaver : Form
    {
        private Point MouseXY;
        public frmScreenSaver()
        {
            InitializeComponent();
        }
        private void frmScreenSaver_Load(object sender, EventArgs e)
        {
            Bounds = Screen.PrimaryScreen.Bounds;
            Cursor.Hide();
            TopMost = true;
            BackgroundImage = Program.conf.bg_img;
        }
        private void frmScreenSaver_MouseMove(object sender, MouseEventArgs e)
        {
            if (!MouseXY.IsEmpty)
            {
                if (MouseXY != new Point(e.X, e.Y))
                    activateBoobyTrap();
            }
            MouseXY = new Point(e.X, e.Y);
        }
        private void frmScreenSaver_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Clicks > 0)
                activateBoobyTrap();
        }
        private void activateBoobyTrap()
        {
            
            new frmTrap(this).ShowDialog();
            Close();
        }
        private void frmScreenSaver_KeyPress(object sender, KeyPressEventArgs e)
        {
            activateBoobyTrap();
        }
    }
}
